﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Configuration;
using System.Collections.Generic;
using System.Collections;
using PersistentObject.Common.Criteria;
using PersistentObject.SqlServer2012;
using System.Data;
using System.Linq;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using PersistentObject.StudentTest.Entities;
using PersistentObject.Common;
using PersistentObject.MySql;
using PersistentObject.Oracle11GR2;
using PersistentObject.Common.Attributes;

namespace PersistentObject.StudentTest
{
    [TestClass]
    public class OrmTestInOracle11GR2 : BaseOrmTest
    {
        static BaseDialect dialect = new Oracle11GR2Dialect();
        public override Common.BaseDialect Dialect
        {
            get { return dialect; }
        }

        public override string ConfigName
        {
            get { return "StudentsOracle"; }
        }

        [TestMethod]
        public void TestColumnRenaming()
        {
            tutor t1 = new tutor() { Tutor = "Test" };
            Connection.Save<tutor>(t1);

            var r2 = Connection.Load<tutor>();
            var t2 = r2.First();
            Assert.AreEqual(t2.Tutor == "Test", true);
            Assert.AreEqual(string.IsNullOrEmpty(t2.GUID), false);

            Connection.Delete<tutor>(t2);
        }
    }

    [Persist("TUTOR")]
    public class tutor
    {
        public tutor()
        {
            GUID = Guid.NewGuid().ToString();
        }

        [Key(false)]
        public string GUID { get; set; }
        [Persist("TUTOR")]
        public string Tutor { get; set; }
    }
}
